﻿using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
using StructureMap;

namespace PowerBooking.RSE.IoC
{
    /// <summary>
    /// 注入实例对象提供器
    /// </summary>
    internal class IoCInstanceProvider : IInstanceProvider
    {
        private readonly Type serviceType;

        public IoCInstanceProvider(Type serviceType)
        {
            this.serviceType = serviceType;
        }

        public object GetInstance(InstanceContext instanceContext)
        {
            return GetInstance(instanceContext, null);
        }

        public object GetInstance(InstanceContext instanceContext, Message message)
        {
            return ObjectFactory.GetInstance(serviceType);
        }

        public void ReleaseInstance(InstanceContext instanceContext, object instance)
        {

        }
    }
}
